package cn.sh.yhk.configure.elasticsearch;

import org.frameworkset.elasticsearch.ElasticSearchHelper;
import org.frameworkset.elasticsearch.client.ClientInterface;
import org.springframework.stereotype.Service;

@Service
public class EsRestService {
    /**
     * 获取操作默认的es集群的客户端工具组件
     *
     * @return
     */
    public ClientInterface restClient() {
        return ElasticSearchHelper.getRestClientUtil();
    }

    /**
     * 获取操作默认的es集群的加载dsl配置文件的客户端工具组件
     *
     * @return
     */
    public ClientInterface restDemoConfigClient() {
        return ElasticSearchHelper.getConfigRestClientUtil("esmapper/demo.xml");
    }

    /**
     * 获取操作logs的es集群的客户端工具组件
     *
     * @return
     */
    public ClientInterface restClientLogs() {
        return ElasticSearchHelper.getRestClientUtil("logs");
    }

    /**
     * 获取操作logs的es集群的加载dsl配置文件的客户端工具组件
     *
     * @return
     */
    public ClientInterface restConfigClientLogs() {
        return ElasticSearchHelper.getConfigRestClientUtil("logs", "esmapper/demo.xml");
    }
}
